using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Entities;
using BUS;
using DAL;
using Utility;


public partial class Admin_HangSanXuatUpdate : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
            LoadData();
       
    }
    private void LoadData()
    {
       try
        {
        int id = int.Parse(Request.QueryString["id"].ToString());
        tbHangSanXuat hsx = tbHangSanXuatBUS.GetByID(id);
        if (hsx != null)
            {
            txt_mahsx.Text = hsx.IDHangSanXuat.ToString();
            txt_tenhsx.Text = hsx.TenHangSanXuat;
            txt_dc.Text = hsx.DiaChi;
            txt_dt.Text = hsx.DienThoai;
            txt_email.Text = hsx.Email;
            }
       }
        catch
        {
            Response.Redirect("~/Admin/HangSanXuatList.aspx");
        }
    }
    protected void bthsx_update_Click(object sender, EventArgs e)
    {
        
            tbHangSanXuat hsx = new tbHangSanXuat();
            hsx.IDHangSanXuat = int.Parse(txt_mahsx.Text);
            hsx.TenHangSanXuat = txt_tenhsx.Text;
            hsx.DiaChi  = txt_dc.Text;
            hsx.DienThoai = txt_dt.Text;
            hsx.Email = txt_email.Text;
            tbHangSanXuatBUS.Update_HangSanXuat(hsx);
        
            Response.Redirect("~/Admin/HangSanXuatList.aspx");
    }
}
